Im trying to connect Linkedin to my Python.
and Im trying to run these in Visual Studio
For the below line,
$ pip install python-linkedin
it keeps throwing syntax error, not reading that $pip correctly.
I followed few videos and posts on Stackoverflow, and they suggested to click on "View" -> "Tools" -> Python environments, but I can`t find this "Tool" and Python environments from View option
Is there any alternative solutions to this?
Screenshot is my Visual Studio setting, if it helps..
VS setup
You need to install Python support for VS to work with python.
https://learn.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio?view=vs-2019
Once you do that you should be able to see the python environment tab. It would look like this:
Another potential issue is that pip for python3.x is usually installed as pip3.x, not pip, so if you are using python 3x, you would need to change your settings.json accordingly.
Related
Despite im used to program stuff, im new in Python so i decide to learn by myself.
So, i install VS code and python. At the moment i tryied to use stuff like tensorflow, is showing an error saying that my imports are missing.
I've already tryed to install everything again, search for a solution online and nothing worked.
If someone knows anything about how to fix this i'd be greatfull.
Whether there are multiple versions of python in your environment, which will make the pip installed in one version of python instead of the python you are using.
Use shortcuts "Ctrl+shift+P" and type "Python: Select Interpreter" to choose the correct python. Then use pip install packagename to reinstall the package which you need.
Generally, we recommend people new to python to use the conda virtual environment.
Confirm you have downloaded python correctly:
Open terminal
Run python --version
(if that doesn't work try python3 --version
I would like to use html2text in my python script, I've installed it via pip install html2text, and it is now in the %Roaming%\Python\Python310\Scripts.
I can also see it while checking what plugins I have installed and in the visual studio code it's green. However when I run the code this message appears:
This is how it looks in VS Studio Code
So I've found out the solution. It seemed to me like a bug and it was. I had somehow installed some extension from the Windows store - uninstall it, and you should be fine.
In the bottom right of the status bar in VS Code, it will show you which Python environment you're using. You'll need to make sure that you've selected the correct Python installation in VS Code by clicking the Python version in the status bar (make sure it matches with the Python version when you type python into the terminal). If that doesn't work, your Pip could be pointing to the wrong version (run pip -V to find out where it's pointing).
Visual Studio says I'm running Python 0.0 AND 3.10
Visual Studio is unable to find a package. I am able to run it in cmd using python.
I have had this problem before, but can't remember how I fixed it. I think I'm using the wrong version of python, but if that is the problem I don't know how to fix it.
Edit: using py -3.10 -m pip install package, instead of just pip install package seems to have worked.
Check the version in cmd and then if it is something above 3.7 or so you are good to go else reinstall python and if you are on Windows then check the box at bottom of the installation window of python which says "Add pip to path" something like that
Now in the VS Code
Hit Ctrl+Shift+p to open command palette and in that search for python interpreter and change it to plain one or you may choose
Select Python Interpreter
use the vscode console
First of all to check the packages insatalled in python you have to use the pip freeze.
pip freeze
This will help you to find out if the required package which you've installed is on the list or not.
If it is not present use the same console for:-
pip install <packageName>
for eg.
pip install django
then check the list agian
Alright, I need some pointers. I am missing something. I am trying to use Pillow through Python 3.6. The platform I use is Visual Studio 2017. I can't get it to work.
I downloaded Pillow from this website:
https://pypi.org/project/Pillow/
And ran the installer.
According to my research, I need pip to install it; which comes built-in python 3.6. I have seen sign that it is actually installed through my module in visual studio (pip 9.0.3). I simply need to use the following line:
from pip.commands import install
and also tried
import pip
Now, according to this:
https://pillow.readthedocs.io/en/5.2.x/installation.html
All I have to do is
pip install Pillow
Though other sites indicate that PIL is still being used. I have tried both without success. Pillow is not recognized and a error comes in: invalid syntax.
I am clearly doing something wrong. I consulted some youtube tutorial; they all skip that part. They download then go straight to their coding platform and it works.
I can only guess I have additional steps to do with Visual Studio.
Also... The location of my files might be out of whack due to IT security on my work laptop. Could that be an issue?
You can do the following:
python -m pip install pillow
No need to downloade Pillow from the website.
After that, to use it you can do:
import PIL
Thanks for the feedback. I played with Visual Studio some more; there is a way of getting it straight from the menu.
I opened a Python 3.6 project/solution. On the "Python Environment" node in the solution explorer, I right clicked and created a virtual Python environment.
Then I right clicked on the virtual environment and selected "Install Python Package...".
You can then search the package you need for your project.
I don't know if this is the most efficient way. From my research, I think the package are only applicable to my virtual environment; I still have to test that out to make sure.
I may have gone the long way around, but writing the proposed code did not work out. I am sure it works, but I am thinking I might not be using it in the right location.
Anyway, thanks for the help!
Trying to install python-docx through pip for 'Learn to Automate the Boring Things with Python'. I am getting errors like this.
I have Googled up some solutions to this issue, but they don't seem to work for me, or I am not deploying the solution correctly.
One post on Stackoverflow said to download an lxml file made available by Christoph Golke.
I downloaded, and then tried 'pip install lxml', and basically got the same error message as the screenshot, telling me 'Unable to find vcvarsall.bat'.
Am I supposed to put this file in a certain directory, before executing that command? Any help would be appreciated.
This mean that C++ Common Tools are not installed.
To install them for Python2.7 go to Microsoft Visual C++ Compiler for Python 2.7
For python3 install Visual Studio Community 2015 and execute the following command:
SET VS90COMNTOOLS=%VS140COMNTOOLS%
so I found the answer to this issue.
So I wasn't aware that to install the lxml file, you first need to change to the directory of that file, and type in the complete name of that file. Either that, or typing the path of the lxml file directly into the cmd prompt, like:
pip install C:\Users\yourName\Downloads\lxml-3.6.4-cp35-cp35m-win32
or
cd C:\Users\yourName\Downloads
pip install lxml-3.6.4-cp35-cp35m-win32
which successfully installed the lxml file, which then led to a successful installation of the python-docx file.
Essentially, a basic knowledge of the command prompt would've helped me avoid this problem...but hope this helps for anyone else who doesn't know what to do!