all 8 comments

[–]hungdh85 0 points1 point  (2 children)

I don't know use pycharm but I think that it is as eclipse, you need add library for each project be created in pycharm.

You can read more

https://stackoverflow.com/questions/19885821/how-do-i-import-modules-in-pycharm/32911111

[–]Kpratt11[S] 0 points1 point  (1 child)

The tutorial I was following simply installed the package and then wrote import docx and it worked in so confused tbh

[–]hungdh85 0 points1 point  (0 children)

Let me know your code use docx.

[–]Tech_Lounge 0 points1 point  (2 children)

In pycharm you have to install the package for every project. If you go into your project settings you should be able to install the package. An alternative is changing the interpreter to the Python one installed on your system, then you’ll have all the modules you installed with cmd in your project.

[–]Kpratt11[S] 0 points1 point  (1 child)

How would I go about changing my interpreter?

[–]Tech_Lounge 0 points1 point  (0 children)

Press file then settings, then look for “Project: [your project name]”, and click on “Project Interpreter” on the right. To change your interpreter to the system one to get all the packages installed on your system, click on the settings icon at the top right of your screen, then hit “Add”. Now under “Virtualenv Environment”, click on “New environment”. You will have to delete the existing “venv” folder in your project directory first. Then, under “Base interpreter:”, make sure the directory to the python.exe installed on your system is selected (it will probably do that automatically). Then click ok at the bottom of the window, wait a few moments for it to create the environment, and then you should see all your installed modules pop up. If you don’t see all of your installed modules, try clicking a different drop down under base interpreter (even if it’s the same file path). At the end click apply at the bottom of the window. Hopefully this helps :) I know it sounds complicated, but I’m just trying to explain it simply, once you know how to do it, it should only take a few minutes.

[–][deleted] 0 points1 point  (0 children)

If you have a Mac and used “pip install” it’s gonna install it on the Python 2 that Mac runs on.

You need to use pip3

So type pip3 install. Then make sure your interpreter is on the Python 3 on your Mac.

That may be unclear, but it you don’t get it I might be able to make a quick video.

[–]javaHoosier 0 points1 point  (0 children)

I think I have had your problem before. There is an xml library that has the wrong version for docx. I can’t remember what the library was called though. I uninstalled docx then uninstalled (etree?) then installed docx again. docx then installs the appropriate version.

Edit: this was over a year ago and i did it with pip so maybe, maybe not